<?php

namespace App\Model;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use mysql_xdevapi\Exception;

class CloseRoomLog extends BaseModel
{
    protected $connection = 'mysql';
    protected $table = 'room_close_log';
    private $fields = ['id','room_uid'];


    public static function addLog($data)
    {
        return DB::table('room_close_log')->insert($data);
    }

    public static function editLog($id,$data = [])
    {
        return DB::table('room_close_log')->where(['id'=>$id])->update($data);
    }


    public function getList(Request $request){
        $limit = $request->input('limit',10);
        $room_uid = trim($request->input('room_uid',''));
        return DB::table('room_close_log')->where(['type'=>1])->where('room_uid','like',"{$room_uid}%")->orderBy('id','desc')->paginate($limit);
    }


}
